package com.cn.web.controller;




import com.cn.api.ApiResult;
import com.cn.param.LoginUserParam;
import com.cn.web.service.LogService;
import com.cn.web.service.PermissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/sysUser")
public class SysUserController {

    @Autowired
    private LogService logService;

    @Autowired
    private PermissionService permissionService;


    /**
     * 自定义登录
     * @param param 登录传参
     * @return
     */
    @PostMapping("/login")
    public ApiResult login(@RequestBody LoginUserParam param) {
        return logService.login(param);

    }


    /**
     * 自定义登出
     * @return
     */
    @PostMapping("/logOut")
    public ApiResult logOut() {

        return logService.logOut();

    }

    /**
     * 用户注册
     * @return
     */
    @PostMapping("/register")
    public ApiResult register(@RequestBody LoginUserParam param){
        return logService.register(param);
    }

    /**
     * 权限查看
     * @return
     */
    @GetMapping("/permissionQuery")
    public ApiResult permissionQuery(){
        return permissionService.permissionQuery();
    }

    /**
     * 权限分配
     * @return
     */
    @GetMapping("/allotQuery")
    public ApiResult allotQuery(Integer permission,Integer user){
        return permissionService.allotQuery(permission,user);
    }

}

